<div id="div_role_add">
新增角色
<form name="role_add_form" id = "role_add_form">
<p>角色名：<input type="text" name="rolename"></p>
<p>备　注：<input type="text" name="rolenote"></p>
<input type="hidden" name="scid" value="auth_2">
<input type="button" id="role_add_form_submit" value="提交"><div id="role_add_submit"></div>
</form>
</div>


<script type="text/javascript">
	var mainPanel = 'mainPanel';
	$('role_add_form_submit').addEvent('click', function(e){
		$('role_add_form').set('send', {
    		url: '/data/sc.action', 
    		onSuccess:function(responseText, responseXML){
    			//alert(responseText);
    			$('role_add_form_submit').set('disabled', false);
    			$('role_add_submit').innerHTML = '';
    			var myjson = JSON.decode(responseText);
    			if (myjson.error.errorcode==0){
    				MUI.notification('添加成功！');
    				if (roles) { roles.goPage(1); }
    				MUI.updateContent({
						'element':  $(mainPanel),
						'url':      '/mochaui/data/roles.html',
					});
    			}else{
    				MUI.notification('<font color=red>错误：</font>('+myjson.error.retstring+')');
    			}
    		},
    		onFailure:function(instance){
    			MUI.notification('<font color=red>错误：</font>访问失败('+instance+')');
    			$('role_add_form_submit').set('disabled', false);
    			$('role_add_submit').innerHTML = '';
    		}
		});
		$('role_add_form_submit').set('disabled', true);
		$('role_add_submit').innerHTML = '<img src="images/spinner.gif" width="16px" height="16px">';
		$('role_add_form').send();
	});

</script>